def paging(models, page=0, rows=10):
    pageInfo = {}
    total_count = 0
    if page:
        pageInfo['page'] = page
        pageInfo['rows'] = rows

        total_count = models.count()
        pageInfo['total'] = total_count

        offset = (page - 1) * rows

        models = models.offset(offset).limit(page)

    return models, total_count

